package com.jlcindia.hibernate;

import org.hibernate.*;

import com.jlcindia.dao.CustomerDAO;
import com.jlcindia.dao.DAOFactory;

public class JLab17 {
	public static void main(String args[]) {
		CustomerDAO cdao = DAOFactory.getCustomerDAO();
		
		//1.add customer
		Customer cto = new Customer(5, "ds", "ds@jlc.com", 9999, "Blore", "Enabled");
		cdao.addCustomer(cto);

		
		//2. get Customer
		Customer c1 = cdao.getCustomerByCid(1);
		System.out.println(c1);
		
		// 3. delete Customer
		cdao.deleteCustomer(1);
		
		// 4.update Customer
		Customer c2 = cdao.getCustomerByCid(2);
		c2.setCname("vas");
		c2.setEmail("vas@jlc");
		c2.setPhone(9999);
		cdao.updateCustomer(c2);
	}
}
